package com.zzb.dao.impl;


import com.zzb.dao.UserDao;
import com.zzb.entity.UserEntity;
import com.zzb.util.MyBatisUtils;

import java.util.List;

public class UserDaoImpl implements UserDao {


    @Override
    public UserEntity findByName(UserEntity userEntity) {
        UserDao userDao = MyBatisUtils.getMapper(UserDao.class);
        return userDao.findByName(userEntity);
    }

    @Override
    public int add(UserEntity userEntity) {
        UserDao userDao = MyBatisUtils.getMapper(UserDao.class);
        return userDao.add(userEntity);
    }

    @Override
    public int delete(UserEntity userEntity) {
        UserDao userDao = MyBatisUtils.getMapper(UserDao.class);
        return userDao.delete(userEntity);
    }

    @Override
    public UserEntity findById(UserEntity userEntity) {
        UserDao userDao = MyBatisUtils.getMapper(UserDao.class);
        return userDao.findById(userEntity);
    }

    @Override
    public List<UserEntity> findAll(UserEntity userEntity) {
        UserDao userDao = MyBatisUtils.getMapper(UserDao.class);
        return userDao.findAll(userEntity);
    }

    @Override
    public int update(UserEntity userEntity) {
        UserDao userDao = MyBatisUtils.getMapper(UserDao.class);
        return userDao.update(userEntity);
    }

    @Override
    public int count(UserEntity userEntity) {
        UserDao userDao = MyBatisUtils.getMapper(UserDao.class);
        return userDao.count(userEntity);
    }

    @Override
    public UserEntity findByUsernameAndPassword(UserEntity userEntity) {
        UserDao userDao = MyBatisUtils.getMapper(UserDao.class);
        return userDao.findByUsernameAndPassword(userEntity);
    }
}
